﻿using Microsoft.Extensions.Hosting;
using System;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Console;

namespace ConsoleClient
{
    class Program
    {
        static void Main(string[] args)
        {
            IHostBuilder host = CreateHostBuiler(args);
            host.Build().Run();
        }

        private static IHostBuilder CreateHostBuiler(string[] args)
        {
            return Host.CreateDefaultBuilder(args)
                 .ConfigureLogging((context, builder) =>
                 {
                     builder.AddConsole(options =>
                     {
                         options.LogToStandardErrorThreshold = LogLevel.Information;
                     });
                 })
                 .ConfigureServices(service =>
                 {
                     service.AddHostedService<ConsoleHostedService>();
                 });
        }
    }
}
